package com.hj.homework;

public class Test2 {
    public static void main(String[] args) {
        Worker worker1 = new Worker();
        Apple apple1 = new Apple(5, "青色");
        Apple apple2 = new Apple(3, "红色");
        worker1.pickApple(new CompareAble() {},apple1,apple2);
        CompareAble compareAble=new CompareAble() {
            @Override
            public void compare(Apple a1, Apple a2) {
                System.out.println("挑红的：");
                if ("红色".equals(a1.getColor())){
                    System.out.println(a1);
                }
                if ("红色".equals(a2.getColor())){
                    System.out.println(a2);
                }
            }
        };
        compareAble.compare(apple1,apple2);
    }
}
